/**
 * 作者: wgx
 * 日期: 2024-12-04 17:23:45
 * 备注: 物资争夺名人广播
 */
package com.motu.monstercity.server.game.userdata;

import com.motu.monstercity.protocol.CsGameFight.PBServerSnatchFame;
import com.motu.monstercity.server.game.logic.GameUser;
import com.motu.vertx.module.utility.toolset.TimeUtils;
import io.vertx.ext.auth.User;

public class ServerSnatchFame extends ServerSnatchFameModel {
    public ServerSnatchFame() {
        super();
    }

    public ServerSnatchFame(UserInfo userInfo, long defendId, int koNum){
        super();
        long curTime = TimeUtils.getCurTime();
        UserInfo userInfoDefend = GameUser.getUserInfo(defendId);
        putServerId(userInfo.getServerId());
        putDateTime(TimeUtils.getStartTimeOfDay(curTime));
        putAttactId(userInfo.getId());
        putAttactLevel(userInfo.getLevel());
        putAttactName(userInfo.getUserName());
        putDefendId(defendId);
        putDefendName(userInfoDefend.getUserName());
        putKoNum(koNum);
        putFightTime(curTime);
    }

    public PBServerSnatchFame.Builder takeInitBuilder() {
        PBServerSnatchFame.Builder sb = super.takeInitBuilder();
        UserInfo userInfo = GameUser.getUserInfo(getAttactId());
        if (userInfo != null) {
            sb.setAttactIcon(userInfo.getIcon());
            sb.setAttactIconFrame(userInfo.getIconFrame());
        }
        return sb;
    }
}
